<template>
	<view class="container">
		<uni-list>
			<view v-for="(item, index) in union">
				<uni-list-item clickable :title="item.name" :key="item.id" :note="item.serverId + '服'" link="navigateTo"
					:to="`/pages/unionMenu/unionMenu?unionId=${item.id}`">
				</uni-list-item>
			</view>
		</uni-list>
	</view>

</template>
<script>
	export default {
		data() {
			return {
				union: []
			}
		},
		methods: {
			onload(){
				uni.request({
					url: getApp().globalData.url + '/api/union/getMyUnion',
					header: {
						'content-type': 'application/json',
						'token': getApp().globalData.token
					},
					success: (res) => {
						if (res.data.code == "00000") {
							this.union = res.data.data
						}
					}
				});
			}
		},
		onLoad(option) {
			this.onload()
		},
		onShareAppMessage: function(options) {
			var that = this;
			var shareObj = {
				path: '/pages/menu/menu'
			};
			return shareObj;
		},
		onPullDownRefresh:function(){
			this.onload()
			uni.stopPullDownRefresh()
		}
	}
</script>

<style>
	.container {
		padding: 20rpx;
	}
</style>
